<!DOCTYPE html>

<!--

  Author: nicksantos@google.com (Nick Santos)
-->

<html>
<!--
Copyright 2009 The Closure Library Authors. All Rights Reserved.

Use of this source code is governed by an Apache 2.0 License.
See the COPYING file for details.
-->
<head>
<title>JsUnit tests for goog.events.BrowserEvent</title>
<script type='text/javascript' src='../base.js'></script>
<script type='text/javascript'>

goog.require('goog.events.BrowserEvent');
goog.require('goog.testing.jsunit');
goog.require('goog.userAgent');


</script>
</head>
<body>
<script type='text/javascript'>

/**
 * @see https://bugzilla.mozilla.org/show_bug.cgi?id=497780
 */
function testInvalidNodeBug() {
  if (!goog.userAgent.GECKO) return;

  var event = {};
  event.relatedTarget = {};
  event.relatedTarget.__defineGetter__(
      'nodeName',
      function() {
        throw Error('https://bugzilla.mozilla.org/show_bug.cgi?id=497780');
      });
  assertThrows(function() { return event.relatedTarget.nodeName; });

  var bEvent = new goog.events.BrowserEvent(event);
  assertEquals(event, bEvent.event_);
  assertNull(bEvent.relatedTarget);
}

</script>
</body>
</html>
